﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using BusinessFacade;

namespace MedicareNoteManagerWeb
{
    public class Global : System.Web.HttpApplication
    {
        private int times=0;

        protected void Application_Start(object sender, EventArgs e)//全局程序运行的时间间隔
        {
           
            Time_Task.Instance().ExecuteTask += new System.Timers.ElapsedEventHandler(Global_ExecuteTask);
            Time_Task.Instance().Interval = 1000 * 3600;//表示间隔
            Time_Task.Instance().Start();
        }
        void Global_ExecuteTask(object sender, System.Timers.ElapsedEventArgs e)//每小时执行的任务
        {
             Busi_sys_backups de = new Busi_sys_backups();
            int time = de.selecttime();//查询备份的时间间隔
            times = times + 1;
            if(time==times)
            {
                backups se = new backups();
                se.Execute();
                times = 0;
            }
        }
        
    }
}